/*
2GWVS a free web vulnerability scanner.
Copyright (C) 2008  Grigis Gaetan

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include "urlCatched.h"
#include <QDebug>
QList<UrlCatched*> *UrlCatched::allUrl=new QList<UrlCatched*>();

UrlCatched::UrlCatched(const QString &u,bool ur) : QUrl(u) {/*url=QUrl(u);*/scanned=false;canBeUrlRewriting=ur;}

void UrlCatched::addToList() {
	allUrl->push_back(this);
        QString mesg="Adding Url : "+this->toString()+"\n";
	runScanner::setLog(mesg);
}
QUrl &UrlCatched::getUrl() {return *this;}
UrlCatched::~UrlCatched() {delete item;}

bool UrlCatched::isInList(const QUrl &url) {
        for(int i=(allUrl->count()-1);i>0;i--)
	{
		if(url==allUrl->at(i)->getUrl())
                        return true;//WTF NAAB!!! ret=true;
	}
        return false;
}

void UrlCatched::setItem(QTreeWidgetItem * i) {
	item=i;
}

QTreeWidgetItem *UrlCatched::getItem() {
	return item;
}

bool UrlCatched::UrlRewriting() {
	return canBeUrlRewriting;
}

void UrlCatched::isUrlRewrited(bool ur) {
	isUrlRewriting=ur;
}

bool UrlCatched::isUrlRewrited() {
	return isUrlRewriting;
}
